{include file='fcworker/fc_head'}
<style type="text/css">
    .td-img{
        width: 25px;
        height: 25px;
        border-radius: 25px;
    }
    .ac-notice{
        width: 92%;
        margin: 8px auto;
        padding: 8px;
        line-height: 20px;
        text-align: center;
        display: block;
        font-size: 13px;
        box-shadow: 0 0  5px 5px rgba(0, 0, 0, 0.06);
        border-radius: 8px;
    }
    .picker-form{
        display: inline;
        width: 50%;
    }
    .setTitle{
        position: fixed;
        left: 0.2rem;
        top: 0;
        z-index: 2;
        overflow: hidden;
        line-height: 1.37rem;
        height: 1.37rem;
        background-size: 100% 1.37rem;
    }
    .h167{
        height: 1.67rem;
    }
    .new_tr{
        height: 0.8rem !important;
        line-height: 0.8rem !important;
    }
    .tabTit{
        position: fixed;
        top: 1.9rem;
        width: 100%;
        background: #fff;
    }
    .fixed_t_w{
        /*position: fixed;*/
        top: 4rem;
        width: 100%;
        bottom: 0;
        overflow-y: scroll;
        max-height: calc(100vh - 2rem);
    }
    .fixed_t_w18{
        top: 1.8rem;
    }
    .fixed_t_w th{
        position: sticky;
        top:0;
    }
    .tabTit{
        padding-bottom: 1rem;
    }
    .tabTit:after{
        margin-top: 0;
        top: 0.19rem;
    }
    .container{
        padding-top: .15rem;
    }
</style>

<div id="mescroll" class="mescroll">
    <div id="app">
        <div id="span">
            {if !$uid}
            <div class="container" style="height: 3.55rem">
                <div class="numPeople" style="height: 3.4rem">
                    <ul style="height: 3.2rem;overflow-y: scroll;">
                        {loop $invite_gift_list $key $item}
                        <a href="/{php echo createMobileUrl('X_giftRecord',array('themeid'=>$themeid,'classify'=>$item['classify'],'taskid'=>$item['taskid']));}"
                           data-method="viewclass"  class="checkBtn1">
                            <li >
                                <p {if $item['taskid']==$taskid&&$item['classify']==$classify}style="color:#FCF95F;"{/if}>{php echo mb_substr($item['name'],0,10);}</p>
                                <span {if  $item['taskid']==$taskid&&$item['classify']==$classify}style="color:#FCF95F;"{/if}>{$item['number']}</span>
                            </li>
                        </a>
                        {/loop}
                    </ul>
                </div>
            </div>
            {else}
            <div class="setTitle">
                <a href="javascript:history.back(-1)"></a>
                {if empty($list)}
                获得记录
                {else}
                {php echo mb_substr($list[0]['username'],0,5);}-获得记录
                {/if}
            </div>
            {/if}

            <div class="activeBox" style="margin-top: .2rem">
                <div class="activeInfor activeTab fixed_t_w fixed_t_w18">
<!--                    <div class="activeInfor activeTab fixed_t_w ">-->

                        <table cellpadding="0" cellspacing="0" width="100%" id="list">
                            <tr style="height: 40px;">
                                <th style="width:.7rem;">序号</th>
                                <th style="width:1.4rem;">粉丝</th>
                                <th style="width:1.4rem;">产品名称</th>
                                <th style="width:1.4rem;">状态</th>
                                <th style="width:1.8rem;">核销信息</th>
                                <th style="width:1.2rem;">电话</th>

                            </tr>
                            {loop $list $key $item}
                            <tr class="new_tr">
                                <td><?php echo $item['order'] ?> </td>
                                <td><img src="{$item['avatar']}" class="td-img"><br>{$item['username']}</td>
                                <td>{php echo mb_substr($item['gift_name'],0,5);}</td>
                                <td>
                                    {if $item['status']==2}
                                    <span style="color: #ffffff;border: 1px solid #07c160;padding: 4px;background-color: #07c160;">已核销</span>
                                    {else}
                                    <span style="color: #ffffff;border: 1px solid #ff0000;padding: 4px;background-color: #ff0000;">未核销</span>
                                    {/if}
                                </td>
                                <td>
                                    {if $item['status']==2}
                                    {$item['workername']}<br>
                                    {$item['exchange_at']}
                                    {else}
                                    {/if}
                                </td>
                                <td style="text-align: center;padding-left: .34rem;"><a href="tel:{$item['mobile']}" class="telBtn" style="float: none;"></a></td>
                            </tr>
                            {/loop}
                        </table>
                        <div style="height: 60px;width: 100%;"><p style="text-align: center;font-size: 12px;color: gray;" class="tips_p">加载更多..</p></div>
                    </div>
                </div>
                <a href="/{php echo createMobileUrl('x_index',array('themeid'=>$themeid));}" class="homeTag"><img src="{$_G['URL']['FCWORK_CSS']}images/homeBtn.png"></a>
                <input type="hidden" name="page" id="page" value="{$page}">
            </div>
        </div>
    </div>

    <script type="text/javascript">
        const mescroll = new MeScroll("mescroll", {
            down: {
                auto: false,
                callback: () => {
                    mescroll.endSuccess();
                    setTimeout(() => {
                        window.location.reload();
                    },500)
                }
            },
            up: {
                use: false
            }
        })
        document.querySelector(".fixed_t_w").addEventListener('touchmove',function(e){
            e.stopPropagation()
        })
        var loadingState= true;
            $(".fixed_t_w").scroll(function(){
                var height = $(".fixed_t_w").height();
                var scrollSpace = $(".fixed_t_w").scrollTop();
                if (scrollSpace >= $(".fixed_t_w table").height() - height){
                    if(!loadingState){
                        return false;
                    }
                    layer.msg('加载中', {
                        icon: 16
                        ,shade: 0.01
                    });
                    var page = $("#page").val();
                    var next_page = +page+1;
                    var postUrl="/{php echo createMobileUrl('X_giftRecord',array('themeid'=>$themeid,'classify'=>$item['classify'],'taskid'=>$item['taskid']));}";
                    $.ajax({
                        url:postUrl,
                        dataType:'json',
                        method:'post',
                        data: {page:next_page},
                        success:function (e) {
                            $("#page").val(next_page);
                            let data = e.data;
                            let error = e.error;
                            let msg = e.msg;
                            if (error!=0){
                                layer.msg(msg);
                            }else{
                                if (data.list){
                                    $("#list").append(data.list);
                                }
                                if(data.list==''||data.list==null||data.list==undefined){
                                    loadingState = false;
                                    $(".tips_p").html('暂无更多数据！');
                                }
                                layer.closeAll();
                            }

                        }
                    });
                }
            });

    </script>
    {include file='fcworker/fc_base_foot'}